home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: Easiest way to center a string?
- Date: 20 Feb 1996 23:38:29 GMT
- Organization: Los Alamos National Laboratory
- Distribution: world
- Message-ID: <TANMOY.96Feb20163829@qcd.lanl.gov>
- References: <4fobka$1st@parlor.hiwaay.net> <DMqEG5.8z4@eskimo.com>
- <4frif5$e6p@fohnix.metronet.com> <DMuuzG.1yK@eskimo.com>
- <4gbmmo$m5v@airdmhor.gen.nz>
- <Pine.A32.3.91.960220105403.86291D-100000@red.weeg.uiowa.edu>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: The Amorphous Mass's message of Tue, 20 Feb 1996 11:04:40 -0600
-
- In article
- <Pine.A32.3.91.960220105403.86291D-100000@red.weeg.uiowa.edu> The
- Amorphous Mass <robinson@blue.weeg.uiowa.edu> writes:
- <snip>
- That's equivalent to strlen(String + -LineLen), which is in turn
- equivalent to strlen(String[-LineLen]), and the expression String[-80] is
- portable only in the sense that its behavior is undefined on all
- platforms. :)
-
- Sorry there is no trigraph for `&': so if that key is broken, you just
- have to get it fixed :-)
-
- If you meant (strlen(String) - LineLen) / 2 then you will get a
- negative length specifier for any string with fewer than LineLen
- characters. If you meant (LineLen - strlen(String) / 2, then your
-
- strlen returns size_t which is guaranteed unsigned. (I am assuming
- LineLen is not long.)
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-